using Microsoft.EntityFrameworkCore;
using UpdaterManagement.Data;
using UpdaterManagement.Models;

public static class SeedData
{
    public static void Initialize(ApplicationDbContext context)
    {
        context.Database.EnsureCreated();

        if (context.VersionReleases.Any())
        {
            return; // 数据已存在
        }

        var testProducts = new[]
        {
            new VersionRelease { ProductName = "支付前置机", Version = "1.0.0", Description = "初始版本", IsActive = true, CreatedTime = DateTime.Now },
            new VersionRelease { ProductName = "支付前置机", Version = "1.1.0", Description = "功能更新", IsActive = true, CreatedTime = DateTime.Now },
            new VersionRelease { ProductName = "核心系统", Version = "2.0.0", Description = "核心系统初始版本", IsActive = true, CreatedTime = DateTime.Now },
            new VersionRelease { ProductName = "核心系统", Version = "2.1.0", Description = "核心系统更新", IsActive = true, CreatedTime = DateTime.Now },
            new VersionRelease { ProductName = "风控系统", Version = "1.5.0", Description = "风控系统", IsActive = true, CreatedTime = DateTime.Now },
            new VersionRelease { ProductName = "报表系统", Version = "3.0.0", Description = "报表系统", IsActive = true, CreatedTime = DateTime.Now }
        };

        context.VersionReleases.AddRange(testProducts);
        context.SaveChanges();
    }
}